<template>
  <div class="error-container">
    <div class="error-content">
      <div class="error-image">
        <img src="@/assets/404_images/404.png" alt="404">
      </div>
      <h1 class="error-title">404</h1>
      <div class="error-desc">抱歉，您访问的页面不存在</div>
      <div class="error-actions">
        <el-button type="primary" @click="goHome">返回首页</el-button>
        <el-button @click="goBack">返回上一页</el-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Error404',
  methods: {
    goHome() {
      this.$router.push('/')
    },
    goBack() {
      this.$router.go(-1)
    }
  }
}
</script>

<style lang="scss" scoped>
.error-container {
  height: 1080px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f8f9fa;

  .error-content {
    text-align: center;
    padding: 40px;

    .error-image {
      margin-bottom: 30px;

      img {
        max-width: 300px;
        height: auto;
      }
    }

    .error-title {
      font-size: 120px;
      font-weight: 700;
      color: #4A5568;
      margin: 0;
      line-height: 1;
      letter-spacing: 4px;
      text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    }

    .error-desc {
      font-size: 20px;
      color: #718096;
      margin: 20px 0 40px;
      letter-spacing: 1px;
    }

    .error-actions {
      .el-button {
        padding: 12px 30px;
        font-size: 16px;
        margin: 0 10px;

        &:first-child {
          background: #4A5568;
          border-color: #4A5568;

          &:hover {
            background: #2D3748;
            border-color: #2D3748;
          }
        }

        &:last-child {
          color: #4A5568;
          border-color: #4A5568;

          &:hover {
            color: #2D3748;
            border-color: #2D3748;
            background: rgba(74, 85, 104, 0.05);
          }
        }
      }
    }
  }
}

// 响应式适配
@media screen and (max-width: 768px) {
  .error-container {
    .error-content {
      padding: 20px;

      .error-image {
        img {
          max-width: 200px;
        }
      }

      .error-title {
        font-size: 80px;
      }

      .error-desc {
        font-size: 16px;
        margin: 15px 0 30px;
      }

      .error-actions {
        .el-button {
          padding: 10px 20px;
          font-size: 14px;
          margin: 5px;
        }
      }
    }
  }
}

// 深色模式适配
@media (prefers-color-scheme: dark) {
  .error-container {
    background: #1A202C;

    .error-content {
      .error-title {
        color: #E2E8F0;
      }

      .error-desc {
        color: #A0AEC0;
      }

      .error-actions {
        .el-button {
          &:first-child {
            background: #4A5568;
            border-color: #4A5568;

            &:hover {
              background: #2D3748;
              border-color: #2D3748;
            }
          }

          &:last-child {
            color: #E2E8F0;
            border-color: #4A5568;

            &:hover {
              color: #F7FAFC;
              border-color: #2D3748;
              background: rgba(74, 85, 104, 0.2);
            }
          }
        }
      }
    }
  }
}
</style>